package com.book.bookmanager.service;

import com.book.bookmanager.dao.personDao;
import com.book.bookmanager.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(rollbackFor = Exception.class)
public class personServiceImpl implements personService {
	@Autowired
	private personDao pd;

	@Override
	public Person queryByName(String name) {
		return pd.selectByName(name);
	}

	@Override
	public void remove(String name) {
		try {
			pd.delete(name);
		} catch (Exception e) {
			throw new RuntimeException("删除个人信息错误");
		}
	}

	@Override
	public void changePerson(Person person) {
		try {
			pd.updatePerson(person);
		} catch (Exception e) {
			throw new RuntimeException("修改个人信息错误");
		}

	}

}
